import java.util.Arrays;
public class test {
    public static void transform(int[]array){
        int light=0;
        int right=array.length-1;
        while(light<right){
            while(light<right&&array[light]%2!=0){
                light++;
            }
            while(light<right&&array[right]%2==0){
                right--;
            }
            swap(array,light,right);
            }
        }
    public static void swap(int []array,int i,int j) {
        int temp=0;
        temp=array[j];
        array[j]=array[i];
        array[i]=temp;
}
    public static void main(String[] args) {
        int[] array={1,50,100,77,87,66,71,65};
        transform(array);
        System.out.println(Arrays.toString(array));
    }
}